home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / gsdbloo.exe / DEMOE006.PAS < prev    next >
Pascal/Delphi Source File  |  1992-02-24  |  3KB  |  85 lines

  1. program DemoE006;
  2. {------------------------------------------------------------------------------
  3.                               DBase List Selector
  4.                                Expanded Sample 6
  5.                                  Demo Program
  6.  
  7.        Copyright (c)  Richard F. Griffin
  8.  
  9.        10 February 1992
  10.  
  11.        102 Molded Stone Pl
  12.        Warner Robins, GA  31088
  13.  
  14.        -------------------------------------------------------------
  15.        Use GS_DBTBL.PAS object dBTbl_Pick_Obj to select a record from a
  16.        list, then display/edit all record fields on-screen.
  17.  
  18.        **********  Not For Use in a TurboVision Environment  **********
  19.  
  20.        If it does not already exist, the DEMOE6.DBF file will be created
  21.        by using the MakeTestData procedure in GS_GENF.PAS.
  22.  
  23.        A scrollable list of all LASTNAME fields will be displayed.  When
  24.        one is selected, then all fields in the dBase record will be
  25.        displayed on-screen using the FieldUpdateScreen procedure in
  26.        GS_dBFld_Objt.  All fields may be edited and the record will be
  27.        updated.  The memo record may also be viewed and modified.
  28.  
  29.        The list is created by Pick_dBTabl.  It will read the dBase file
  30.        and build a list of LASTNAME elements.  The list is only built once
  31.        and is displayed each time afterwards until it is reset to empty.
  32.        Notice that if LASTNAME is changed, the list entry must be
  33.        changed. To do this, Reset_dBTabl is called.  Since the only thing
  34.        we know for sure is that RecChanged is true, we reset the list any
  35.        time a record is written.
  36.  
  37. -------------------------------------------------------------------------------}
  38.  
  39.  
  40. uses
  41.    CRT,
  42.    DOS,
  43.    GS_KeyI,
  44.    GS_FileH,
  45.    GS_dBFld,
  46.    GS_dBTbl,
  47.    GS_dBase,
  48.    GS_GenF;
  49.  
  50. var
  51.    MyFile  : GS_dBFld_Objt;
  52.    FileTab : dbTabl_Pick_Obj;
  53.    CkFile  : file;
  54.  
  55. begin
  56.    ClrScr;
  57.    if not GS_FileExists(CkFile,'DEMOE6.DBF') then
  58.    begin
  59.       writeln('Creating DEMOE6.DBF');
  60.       MakeTestData('DEMOE6', 20, true);
  61.       writeln('DEMOE6.DBF Created');
  62.       ClrScr;
  63.    end;
  64.    MyFile.Init('DEMOE6');
  65.    MyFile.Open;
  66.    FileTab.Init_dbTabl(MyFile, '[ LASTNAME ]',20,2,60,22,
  67.                        Yellow,Blue,LightGray,Blue,LightGray);
  68.    while FileTab.Pick_dBTabl('LASTNAME') do
  69.    begin
  70.       while MyFile.FieldUpdateScreen do
  71.       begin
  72.          if MyFile.RecChanged then
  73.          begin
  74.             MyFile.PutRec(MyFile.RecNumber);
  75.             FileTab.Reset_dBTabl;
  76.          end;
  77.          if GS_KeyI_Chr = Kbd_PgUp then
  78.             MyFile.GetRec(Prev_Record)
  79.          else
  80.             MyFile.GetRec(Next_Record);
  81.       end;
  82.    end;
  83.    MyFile.Close;
  84. end.
  85.